package com.demo2do.fms.entity.data.cost;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.demo2do.core.format.PersistentFormat;
import com.demo2do.fms.entity.authority.Organization;
import com.demo2do.fms.entity.data.business.VehicleFeature;
import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 汽车修理费
 * 
 * @author Wy
 *
 */
@Entity
@Table(name = "TBL_TRUCK_REPAIR_FEE")
public class RepairFee {
    
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "generator")
    @SequenceGenerator(name = "generator", sequenceName = "HIBERNATE_SEQUENCE", allocationSize = 1)
    private Long id;
    
    /** 费用  */
    private BigDecimal price;
    
    /** 起始公里数  */
    private Integer rangeFrom;
    
    /** 目的公里数  */
    private Integer rangeTo;
    
    /** 动力类型  */
    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    @JoinColumn(name = "power_type_id", referencedColumnName = "id")
    @JsonIgnore(value =true)
    @PersistentFormat
    private VehicleFeature vehicleFeature;
    
    /** 所属公司  */
    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    @JoinColumn(name = "organization_id", referencedColumnName = "id")
    @JsonIgnore(value =true)
    @PersistentFormat
    private Organization organization;
    
    /** 创建人  */
    private Long creatorId;
    
    /** 创建时间  */
    private Date createDate;
    
    /** 开始时间  */
    private Date startDate;
    
    /** 结束时间  */
    private Date endDate;
    
    @Column(name = "is_disabled")
    private Boolean disabled;
    
    /**
     * 
     * the default constructor
     */
    public RepairFee(){
        
    }
    
    /**
     * 
     * @param rangeFrom
     * @param rangeTo
     * @param price
     * @param organization
     * @param vehicleFeature
     */
    public RepairFee(Integer rangeFrom, Integer rangeTo, BigDecimal price, Organization organization, VehicleFeature vehicleFeature){
        this.rangeTo = rangeTo;
        this.rangeFrom = rangeFrom;
        this.price = price;
        this.organization = organization;
        this.vehicleFeature = vehicleFeature ;
    }
    
    /**
     * 
     * 
     * @return
     */
    public RepairFee disabled(){
        this.disabled = true;
        return this;
    }
    
    /**
     * 
     * @return
     */
    public RepairFee init(){
        this.createDate = new Date();
        this.disabled = false;
        this.startDate= new Date();
        this.endDate = new Date();
        return this;
    }
    
    /**
     * 
     * @param operator
     * @return
     */
    public RepairFee operator(Long operator){
        this.creatorId = operator;
        return this;
    }
    
    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the price
     */
    public BigDecimal getPrice() {
        return price;
    }

    /**
     * @return the rangeFrom
     */
    public Integer getRangeFrom() {
        return rangeFrom;
    }

    /**
     * @return the rangeTo
     */
    public Integer getRangeTo() {
        return rangeTo;
    }

    /**
     * @return the vehicleFeature
     */
    public VehicleFeature getVehicleFeature() {
        return vehicleFeature;
    }

    /**
     * @return the organization
     */
    public Organization getOrganization() {
        return organization;
    }

    /**
     * @return the creatorId
     */
    public Long getCreatorId() {
        return creatorId;
    }

    /**
     * @return the createDate
     */
    public Date getCreateDate() {
        return createDate;
    }

    /**
     * @return the startDate
     */
    public Date getStartDate() {
        return startDate;
    }

    /**
     * @return the endDate
     */
    public Date getEndDate() {
        return endDate;
    }

    /**
     * @return the disabled
     */
    public Boolean getDisabled() {
        return disabled;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param price the price to set
     */
    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    /**
     * @param rangeFrom the rangeFrom to set
     */
    public void setRangeFrom(Integer rangeFrom) {
        this.rangeFrom = rangeFrom;
    }

    /**
     * @param rangeTo the rangeTo to set
     */
    public void setRangeTo(Integer rangeTo) {
        this.rangeTo = rangeTo;
    }

    /**
     * @param vehicleFeature the vehicleFeature to set
     */
    public void setVehicleFeature(VehicleFeature vehicleFeature) {
        this.vehicleFeature = vehicleFeature;
    }

    /**
     * 
     * @param organization the organization to set
     */
    public void setOrganization(Organization organization) {
        this.organization = organization;
    }

    /**
     * @param creatorId the creatorId to set
     */
    public void setCreatorId(Long creatorId) {
        this.creatorId = creatorId;
    }

    /**
     * @param createDate the createDate to set
     */
    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    /**
     * @param startDate the startDate to set
     */
    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    /**
     * @param endDate the endDate to set
     */
    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    /**
     * @param disabled the disabled to set
     */
    public void setDisabled(Boolean disabled) {
        this.disabled = disabled;
    }


       
}
